package bb.lanxing.fragment.routebook;

import java.util.List;

import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

import androidx.annotation.NonNull;

import bb.lanxing.R;
import bb.lanxing.adapter.RouteBookNormalAdapter;
import bb.lanxing.model.database.RouteBook;

public class ImportRouteBookLocalListFragment extends RouteBookBaseLocalListFragment {
    public ImportRouteBookLocalListFragment() {
        setShowImportRouteBookBtn(true);
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setHasOptionsMenu(true);
    }

    @Override
    protected RouteBookNormalAdapter getLushuNormalAdapter(List<RouteBook> routeBookList) {
        RouteBookNormalAdapter adapter = super.getLushuNormalAdapter(routeBookList);
        adapter.setEnableImport(true);
        adapter.setUpdate(true);
        return adapter;
    }

    @Override
    public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
        inflater.inflate(R.menu.menu_lushu_create_new, menu);
    }

    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        if (item.getItemId() == R.id.action_create) {
            showLushuCreateDialog();
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
